package com.aiguigu.cloud.controller;

import com.aiguigu.cloud.apis.PayFeignApi;
import com.aiguigu.cloud.entities.PayDTO;
import com.aiguigu.cloud.resp.ResultData;
import io.swagger.v3.oas.models.security.SecurityScheme;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;


@RestController
@Slf4j
public class OrderController {
    @Resource
    private PayFeignApi payFeignApi;

    @GetMapping(value = "/feign/pay/add")
    public ResultData addOrder(@RequestBody PayDTO payDTO){
        return payFeignApi.addPay(payDTO);
    }

    @GetMapping(value = "/feign/pay/delete/{id}")
    public ResultData deleteOrder(@PathVariable("id") Integer id){
        return payFeignApi.deletePay(id);
    }

    @GetMapping(value = "/feign/pay/update")
    public ResultData updatePayInfo(@RequestBody PayDTO payDTO){
        return payFeignApi.updatePay(payDTO);
    }

    @GetMapping(value = "/feign/pay/get/{id}")
    public ResultData getPayInfo(@PathVariable("id") Integer id){
        return payFeignApi.getById(id);
    }

    @GetMapping(value = "/feign/pay/get/info")
    public String getInfoByConsul(){
        return payFeignApi.myLoadBalancer();
    }

}
